3.7.72 \(\int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx\) [672]

Optimal. Leaf size=46 \[ \frac {a (A+B \tan (e+f x))^2}{2 (i A+B) c^2 f (1-i \tan (e+f x))^2} \]

[Out]

1/2*a*(A+B*tan(f*x+e))^2/(I*A+B)/c^2/f/(1-I*tan(f*x+e))^2

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3669, 37} \begin {gather*} \frac {a (A+B \tan (e+f x))^2}{2 c^2 f (B+i A) (1-i \tan (e+f x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^2,x]

[Out]

(a*(A + B*Tan[e + f*x])^2)/(2*(I*A + B)*c^2*f*(1 - I*Tan[e + f*x])^2)

Rule 37

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^(n +
1)/((b*c - a*d)*(m + 1))), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[m + n + 2, 0] && NeQ
[m, -1]

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(a+i a \tan (e+f x)) (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx &=\frac {(a c) \text {Subst}\left (\int \frac {A+B x}{(c-i c x)^3} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {a (A+B \tan (e+f x))^2}{2 (i A+B) c^2 f (1-i \tan (e+f x))^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.80, size = 62, normalized size = 1.35 \begin {gather*} \frac {a ((-3 i A+B) \cos (e+f x)-(A+3 i B) \sin (e+f x)) (\cos (3 (e+f x))+i \sin (3 (e+f x)))}{8 c^2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[((a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^2,x]

[Out]

(a*(((-3*I)*A + B)*Cos[e + f*x] - (A + (3*I)*B)*Sin[e + f*x])*(Cos[3*(e + f*x)] + I*Sin[3*(e + f*x)]))/(8*c^2*
f)

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 46, normalized size = 1.00

method result size
derivativedivides \(\frac {a \left (\frac {i B}{i+\tan \left (f x +e \right )}-\frac {-i A -B}{2 \left (i+\tan \left (f x +e \right )\right )^{2}}\right )}{f \,c^{2}}\) \(46\)
default \(\frac {a \left (\frac {i B}{i+\tan \left (f x +e \right )}-\frac {-i A -B}{2 \left (i+\tan \left (f x +e \right )\right )^{2}}\right )}{f \,c^{2}}\) \(46\)
risch \(-\frac {a \,{\mathrm e}^{4 i \left (f x +e \right )} B}{8 c^{2} f}-\frac {i a \,{\mathrm e}^{4 i \left (f x +e \right )} A}{8 c^{2} f}+\frac {a \,{\mathrm e}^{2 i \left (f x +e \right )} B}{4 c^{2} f}-\frac {i a \,{\mathrm e}^{2 i \left (f x +e \right )} A}{4 c^{2} f}\) \(80\)
norman \(\frac {\frac {a A \tan \left (f x +e \right )}{c f}+\frac {i a B \left (\tan ^{3}\left (f x +e \right )\right )}{c f}+\frac {-i a A +a B}{2 c f}+\frac {\left (i a A +3 a B \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 c f}}{c \left (1+\tan ^{2}\left (f x +e \right )\right )^{2}}\) \(95\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f*a/c^2*(I*B/(I+tan(f*x+e))-1/2*(-I*A-B)/(I+tan(f*x+e))^2)

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 3.19, size = 48, normalized size = 1.04 \begin {gather*} \frac {{\left (-i \, A - B\right )} a e^{\left (4 i \, f x + 4 i \, e\right )} - 2 \, {\left (i \, A - B\right )} a e^{\left (2 i \, f x + 2 i \, e\right )}}{8 \, c^{2} f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/8*((-I*A - B)*a*e^(4*I*f*x + 4*I*e) - 2*(I*A - B)*a*e^(2*I*f*x + 2*I*e))/(c^2*f)

________________________________________________________________________________________

Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 153 vs. \(2 (36) = 72\).
time = 0.20, size = 153, normalized size = 3.33 \begin {gather*} \begin {cases} \frac {\left (- 8 i A a c^{2} f e^{2 i e} + 8 B a c^{2} f e^{2 i e}\right ) e^{2 i f x} + \left (- 4 i A a c^{2} f e^{4 i e} - 4 B a c^{2} f e^{4 i e}\right ) e^{4 i f x}}{32 c^{4} f^{2}} & \text {for}\: c^{4} f^{2} \neq 0 \\\frac {x \left (A a e^{4 i e} + A a e^{2 i e} - i B a e^{4 i e} + i B a e^{2 i e}\right )}{2 c^{2}} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))**2,x)

[Out]

Piecewise((((-8*I*A*a*c**2*f*exp(2*I*e) + 8*B*a*c**2*f*exp(2*I*e))*exp(2*I*f*x) + (-4*I*A*a*c**2*f*exp(4*I*e)
- 4*B*a*c**2*f*exp(4*I*e))*exp(4*I*f*x))/(32*c**4*f**2), Ne(c**4*f**2, 0)), (x*(A*a*exp(4*I*e) + A*a*exp(2*I*e
) - I*B*a*exp(4*I*e) + I*B*a*exp(2*I*e))/(2*c**2), True))

________________________________________________________________________________________

Giac [A]
time = 0.66, size = 84, normalized size = 1.83 \begin {gather*} -\frac {2 \, {\left (A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + i \, A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - B a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - A a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{c^{2} f {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{4}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^2,x, algorithm="giac")

[Out]

-2*(A*a*tan(1/2*f*x + 1/2*e)^3 + I*A*a*tan(1/2*f*x + 1/2*e)^2 - B*a*tan(1/2*f*x + 1/2*e)^2 - A*a*tan(1/2*f*x +
 1/2*e))/(c^2*f*(tan(1/2*f*x + 1/2*e) + I)^4)

________________________________________________________________________________________

Mupad [B]
time = 8.49, size = 51, normalized size = 1.11 \begin {gather*} \frac {\frac {a\,\left (-B+A\,1{}\mathrm {i}\right )}{2}+B\,a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}{c^2\,f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2+\mathrm {tan}\left (e+f\,x\right )\,2{}\mathrm {i}-1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i))/(c - c*tan(e + f*x)*1i)^2,x)

[Out]

((a*(A*1i - B))/2 + B*a*tan(e + f*x)*1i)/(c^2*f*(tan(e + f*x)*2i + tan(e + f*x)^2 - 1))

________________________________________________________________________________________